package com.itheima.stock.mapper;

import com.itheima.stock.common.domain.Stock4EvrDayDomain;
import com.itheima.stock.common.domain.Stock4MinuteDomain;
import com.itheima.stock.common.domain.StockUpdownDomain;
import com.itheima.stock.pojo.StockRtInfo;
import com.itheima.stock.vo.resp.CodeRespVo;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @author 呱呱
* @description 针对表【stock_rt_info(个股详情信息表)】的数据库操作Mapper
* @createDate 2022-05-30 15:45:59
* @Entity com.itheima.stock.pojo.StockRtInfo
*/
public interface StockRtInfoMapper {


    int deleteByPrimaryKey(Long id);

    int insert(StockRtInfo record);

    int insertSelective(StockRtInfo record);

    StockRtInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StockRtInfo record);

    int updateByPrimaryKey(StockRtInfo record);

    List<StockUpdownDomain> stockIncreaseLimit(@Param("timePoint") Date lastDate,
                                               @Param("limitNum") Integer num);

    List<StockUpdownDomain> getAllStockUpDownByTime(@Param("timePoint") Date timePoint);

    List<Map> getStockUpDownCount(@Param("openTime")Date openTime,
                                  @Param("closeTime")Date closeTime,
                                  @Param("flag")int flag);

    List<Map> stockUpDownScopeCount(@Param("avlDate")Date avlDate);

    List<Stock4MinuteDomain> getStockSecondInfoByCodeAndTime(@Param("startTime") Date startTime,
                                                             @Param("endTime")  Date endTime,
                                                             @Param("stockCode") String stockCode);

    List<Stock4EvrDayDomain> getStockEvyDayInfoByCodeAndTime(@Param("startTime") Date startTime,
                                                             @Param("endTime")  Date endTime,
                                                             @Param("stockCode") String stockCode);

    int insertBatch(@Param("infos") List<StockRtInfo> list);


    List<CodeRespVo> getStockByCode(@Param("code") String code);

    /**
     * 统计每周内的股票数据信息
     *
     * @param code 代码
     * @return {@link }<{@link Map}>
     */
    List<Map> getStockWeekDKLine(@Param("code") String code);
}
